<{include file="Public/top.html" }>
</head>
<body>
<div id="warpper">
    <div class="content">
        <div class="location">转盘抽奖</div>
        <{include file="./nav.html" }>
        <div class="filedSet" style="padding-bottom: 0;">
            <div class="search">
                <form action="" id="searchForm" method="get" class="ui-form reportForm">
                    <input name="m" type="hidden" value="<{$module}>">
                    <input name="c" type="hidden" value="<{$controller}>">
                    <input name="a" type="hidden" value="<{$action}>">

                    <input name="p" id="page" type="hidden" value="<{$page|default:1}>">
                    <input name="limit" id="limit" type="hidden" value="<{$limit|default:10}>">
                    <input name="ofield" id="ofield" type="hidden" value="<{$ofield}>">
                    <input name="otype"  id="otype"  type="hidden" value="<{$otype}>">


                    <div class="ui-form-item inline-block">
                        <label class="ui-label">开始日期</label>
                        <input id="beginDate" type="text" value="<{$beginDate}>" class="ui-text " name="beginDate" readonly placeholder=""  />
                    </div>

                    <div class="ui-form-item inline-block">
                        <label class="ui-label">结束日期</label>
                        <input id="endDate" type="text" value="<{$endDate}>" class="ui-text " name="endDate" readonly placeholder=""  />
                    </div>

                    <div class="ui-form-item inline-block">
                        <label class="ui-label">名称</label>
                        <input type="text" value="<{$title}>" class="ui-text bg-text keyword" name="title" placeholder="转盘名称"  />
                    </div>


                    <div class="ui-form-item inline-block">
                        <button type="submit" class="ui-button" onclick="LayerShow();">搜索</button>
                    </div>
                    <div class="ui-form-item inline-block">
                        <button type="button" class="ui-button" onclick="location.href='<{u('turnEdit')}>'">增加</button>
                    </div>
                </form>
            </div>
        </div>


        <!--表格内容-->
        <div class="mainGrid">
            <table class="ui-table ui-body">
                <thead>
                <tr>
                    <th class="pct15">设置时间</th>
                    <th class="pct10">转盘名称</th>
                    <th class="pct12">已关联活动数</th>
                    <th class="pct12 last-col">操作</th>
                </tr>
                </thead>
                <tbody>
                <{foreach from=$list item=item}>
                <tr>
                    <td><{$item['addTime']|date_format:"%Y-%m-%d %H:%M"}></td>
                    <td><{$item['title']}></td>
                    <td><{$turnCountKv[$item['id']]|default:0}></td>
                    <td class="ta_l">
                        <div class="handler">
                            <{if $push eq 1}>
                            <{if $item['pushCenter'] eq 0}>
                                            <span id="spanPush<{$item['id']}>">
                                                <a href="javascript:void(0)" onclick="push('<{$item['id']}>')">提交</a>
                                                <span class="sep">|</span>
                                            </span>
                            <{/if}>
                            <{/if}>
                            <a href="<{u('turnEdit?id='|cat:$item['id'])}>" onclick="LayerShow();">修改</a>
                            <span class="sep">|</span>
                            <a id="delete<{$item['id']}>"  onclick="del(<{$item['id']}>,'<{u('delete?id='|cat:$item['id'])}>')" href="javascript:void(0)">删除</a>
                            <span class="sep">|</span>
                            <a onclick='connect("<{u('connect?id='|cat:$item['id'])}>")'  href="javascript:void(0)" >关联活动</a>
                        </div>
                    </td>
                </tr>
                <{/foreach}>
                </tbody>
            </table>
        </div>
        <div class="pagination">
            <!--描述：分页-->
            <{include file="Public/page.html" }>
        </div>
    </div>
</div>
<{include file="Public/foot.html" }>
</body>
</html>
<script>
    function del(id,url){
        if(!confirm('是否执行删除操作')){
            return false;
        }
        $.get(url,function(result){
            if(result.status==0) {
                $('#delete'+id).parent().parent().parent().remove();
            }
            layer.msg(result.msg);

        },'json')
    }
    $(document).ready(function(){
            datePickter('beginDate','endDate',true);
            $('.title').on('mouseover',function (e) {
                if(e.target.tagName!='TD'){
                    return;
                }
                layer.closeAll();
                var url=$(e.target).attr('data');
                var title = e.target.innerText;
                layer.tips("<h1 style='color: #000000;text-overflow:ellipsis;overflow: hidden;display: -webkit-box;-webkit-line-clamp: 1;-webkit-box-orient: vertical;min-height: 25px;'>"+title+'</h1><img src="'+url+'" style="width:280px;height:140px;">', e.target,
                        {
                            tips:[4,'#ffffff'],
                            area: ['300px', '180px'],
                            skin:'BoxShadow'
                        });
            })
    }
    );

    function connect(url){
        layer.open({
            type: 2,
            title: false,
            closeBtn:1, //不显示关闭按钮
            shade: [0],
            area: ['600px', '700px'],
            content: [url, 'no'], //iframe的url，no代表不显示滚动条
        });
    }
</script>
